<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>
<?
require_once("auth.php");
require_once("../utility/rss.class.php");
require_once("../utility/connessione.php");
$strb=" SELECT ID,titolo,descrizione,copyright,image,vimage FROM datirss";
$risultatob = mysql_query($strb);
if (mysql_num_rows($risultatob)>0)
{
   $controlb = mysql_fetch_row($risultatob);        	
	$nomeserver = "http://".$_SERVER['SERVER_NAME'];	
	$titolo = $controlb[1];
	$desc = $controlb[2];	
	$copyright = $controlb[3];
	$rss = new DDRssGen($titolo,$nomeserver,$desc,$nomeserver."/html");
	$rss -> settaRss(array("version" =>'2.0',"xmlns:dc" =>"http://purl.org/dc/elements/1.1/","xmlns:atom" =>"http://www.w3.org/2005/Atom"));
	$rss -> settaXml(array("version" =>'1.0',"encoding" => 'ISO-8859-15'));	
	$rss -> rssAddOpzionali("language","ita");
	$rss -> rssAddOpzionali("copyright",$copyright);
	$rss -> rssAddOpzionali("docs","http://blogs.law.harvard.edu/tech/rss");
	$rss -> rssAddOpzionali("lastBuildDate",date("r"));
	
	
	$rss -> rssSetFile("../custom/","rss");
	if ($controlb[5] =="si")
		$rss -> rssAddImmagine($nomeserver."/img/".$controlb[4],$titolo,$nomeserver,$titolo,"88","31");
	//Notizie inserite
	$str=" SELECT titolo , sottotitolo , testo , autore , argomento , link, UNIX_TIMESTAMP(data),ID FROM notizie where autorizza='si' order by data DESC";
	$risultato=mysql_query($str);
	while($control=mysql_fetch_row($risultato))
	{
		$str1=" SELECT nome FROM anagrafica WHERE ID='$control[3]'";
		$risultato1=mysql_query($str1);
		$control1=mysql_fetch_row($risultato1);
		$str2=" SELECT argomenti FROM argomenti WHERE ID='$control[4]'";
	   $risultato2=mysql_query($str2);
	   $control2=mysql_fetch_row($risultato2);   
		$rss -> rssAddArticolo($control[0],$nomeserver."/html/index.php?pag=news.php&amp;news=".$control[7],"Argomento: ".$control2[0]." - ".$control[1],
		strip_tags($control[2]),$control1[0],date("r",$control[6]),array("guid"=>$nomeserver."/html/index.php?pag=news.php&amp;news=".$control[7],"dc:creator" => $control1[0]));
	}
	//Pagine Statiche
	$str="SELECT corpo,titolo,ID FROM statiche order by ordine";
	$risultato=mysql_query($str);
	while($control=mysql_fetch_row($risultato))
	{
		$rss -> rssAddArticolo($control[1],$nomeserver."/html/index.php?pag=static.php&amp;stat=".$control[2],"Pagina Statica",
		strip_tags($control[0]),"Admin",date("r"),array("guid"=>$nomeserver."/html/index.php?pag=static.php&amp;stat=".$control[2],"dc:creator" => "Admin"));
	}
	//Creazione e verifica successo	
	if ($rss -> rssCreate())
	{
	echo "<br/>
			<br/>
			Creazione del  Rss conclusa con successo
			<br/>
			<br/>";
	}
	else	
	{
		echo "<br/>
				<br/>";
				die("CREAZIONE DEL RSS NON CONCLUSA CON SUCCESSO!!! FILE NON CREATO/MODIFICATO!!!");
	}
}
else	
{
	echo "<br/>
			<br/>";
			die("CREAZIONE DEL RSS NON CONCLUSA CON SUCCESSO!!! MANCANO I DATI IN DB!!!");
}
?>
